import java.util.*;


public class User {

	LinkedList R;
	HashSet L;
	int lastAddedToL = -1;
	int maxRlength=1000; 
        
	ArrayList usersToConsiderforR;
	
	User (int usercount) { //Constructor to inititialize this user
		
		 R = new LinkedList();
	     L = new HashSet();
	     usersToConsiderforR = new ArrayList();
		maxRlength=usercount;
             
	   //  System.out.println("User initialized!");
	}
	
	
	public HashSet getLikeList() {
		return L;
	}
	
	
	
	public void addToUsersToConsiderforR(int user) { 
		
		
		usersToConsiderforR.add(user);
		
		
	}
	
	
	public void resetUsersToConsiderforR() {  
		
		usersToConsiderforR.clear();	
		
	}
	
	public List getListUsersToConsiderforR() {  
		
		return usersToConsiderforR;
		
	}
	
	
	
	public void addToL(int c) {  //Add content to Like list L
	
		if (!L.contains(c)) {   //???THB 
		L.add(c);
		lastAddedToL=c;
		}
	}
	
	
	int likedLast() {
		return lastAddedToL;
	}
	
	int popFromR() {  //Pop content from Recommendation list R
		
		int poppedcontent = -1; 
		if (!R.isEmpty()) {   //???THB pop only one content at a time 
			 poppedcontent = ((int) R.pop());
		}
		return poppedcontent;
	}
	
	
	public void pushToR(int c) {  //Push content to Recommendation List R
		
		R.push(c);
		/**/
                if (R.size()>maxRlength) //usercount  //THB
                    R.removeLast();
                
	}
	
	int sizeR() {
		return R.size();
	}

	int sizeL() {
		return L.size();
	}
	
	String LtoString() {
		
		return L.toString();
	}
	
	String RtoString() {
		
		return R.toString();
	}
	
}
